#pragma once
#include <string>
#include <vector>
#include "BasicSkinObjectAttr.h"
#include "BasicCommonDialogWnd.h"
#include "IBasicRenderObjectScrollBar.h"

namespace BasicSkinView
{
	class CBasicSkinCombo;
	/*
	 *	desc:combo Box list
	 *	author:xxm
	 */
	class CBasicSkinComboList : public CBasicSkinObjectAttr
	{
	public:
		CBasicSkinComboList();
		virtual ~CBasicSkinComboList();
	public:
		virtual bool CL_CreateBasicSkinComboList() = 0;
		virtual void CL_DestroyList() = 0;
		virtual void BsSetObjectAttr(const wchar_t* szKey,void* lpData);
		virtual bool CL_HitTest(POINT ptScreen) = 0;
		virtual HWND CL_GetHostWnd() = 0;
		virtual int  CL_AddString(const wchar_t* szAdd) = 0;
		virtual bool CL_DeleteString(int nIndex) = 0;
		virtual bool CL_SetTopIndex(int nIndex) = 0;
		virtual int CL_GetTopIndex() = 0;
		virtual int CL_GetCurSel() = 0;
		virtual bool CL_SetCurSel(int nSel) = 0;
		virtual int CL_GetItemCount() = 0;
		virtual SIZE CL_CalcFitSize() = 0;
		virtual wstring CL_GetCurSelText() = 0;
		virtual void CL_StartTrackMouse() = 0;
		virtual void CL_SetItemHeight(int nHeight) = 0;
		virtual void CL_SetTextFormat(int nFormat) = 0;
		virtual int CL_GetItemHeight() = 0;
		virtual int SetScrollInfo(LPSCROLLINFO psi) = 0;
		virtual int CL_FindString(const wchar_t* szFind) = 0;
		virtual void UpdateScrollInfo()=0;
		virtual void SetDrop(int cy) = 0;
		virtual void Reset() = 0;
	public:
		void SetCombo(CBasicSkinCombo* pCombo);
		CBasicSkinCombo* GetCombo();
	public:
		CBasicSkinCombo*	m_pCombo;
	};

	/*
	 *	Desc:combo list item
	 *	author:xxm
	 */
	class CBasicComboListItem
	{
	public:
		CBasicComboListItem();
		virtual ~CBasicComboListItem();
	public:
		CBasicComboListItem& operator=(const CBasicComboListItem& item);
	public:
		wstring		m_strItem;
		void*		m_pUserData;
	};

	/*
	 *	desc:combo list wnd 
	 *	author:xxm
	 */
	class CBasicSkinComboListWnd: public CBasicSkinComboList,public CBasicCommonDialogWnd
	{
	public:
		CBasicSkinComboListWnd();
		virtual ~CBasicSkinComboListWnd();
	public:
		virtual void BeginEndRenderView(CBasicSkinCanvas* pCanvas,bool bBegin);
		virtual void OnWidgetClose();
		virtual bool BsOnMessageFilter(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam,LRESULT* lRet,CBasicSkinEvent* pEvent);
		virtual bool BsCanSetFocusWidget();
	public:
		virtual bool CL_CreateBasicSkinComboList();
		virtual void CL_DestroyList();
		virtual void BsSetObjectAttr(const wchar_t* szKey,void* lpData);
		virtual bool CL_HitTest(POINT ptScreen);
		virtual HWND CL_GetHostWnd();
		virtual int  CL_AddString(const wchar_t* szAdd);
		virtual bool CL_DeleteString(int nIndex);
		virtual bool CL_SetTopIndex(int nIndex);
		virtual int CL_GetTopIndex();
		virtual int CL_GetCurSel();
		virtual bool CL_SetCurSel(int nSel);
		virtual int CL_GetItemCount();
		virtual SIZE CL_CalcFitSize();
		virtual wstring CL_GetCurSelText();
		virtual void CL_StartTrackMouse();
		virtual void CL_SetItemHeight(int nHeight);
		virtual void CL_SetTextFormat(int nFormat);
		virtual int CL_GetItemHeight();
		virtual int SetScrollInfo(LPSCROLLINFO psi);
		virtual int CL_FindString(const wchar_t* szFind);
		virtual void UpdateScrollInfo();
		virtual void SetDrop(int cy);
		virtual void Reset();
	public:
		bool IsScrollBarVisible();
		int  CL_HitItem(POINT pt);
		void CL_GetClientRect(LPRECT lpRect);
		LRESULT OnGesture(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
		void ListSetScrollPos(int nPos);
	public:
		int								m_cyDrop;
		bool							m_bScrollCapture;
		int								m_uFormat;
		int								m_nLineHeigth;
		int								m_nTopIndex;
		int								m_nCurSel;
		int								m_nHoverIndex;
		int								m_nMouseOffset;
		POINTS							m_GFStart;
		int								m_nTrackPos;
		IBasicRenderObjectScrollBar		m_nVertBar;
		vector<CBasicComboListItem>		m_vItem;
	};
}